Skip to content

Conversation

@pedropontesgarcia
Copy link
Collaborator

@pedropontesgarcia pedropontesgarcia commented Oct 26, 2025

This PR adds AreaExtract as a tool in the repo, combining functionality that was previously split between technology-specific tools. I wrote a README and pasted it below. The PR also updates the profiler, Petal, to parse the new common data format and produce its area visualizations with it, independently of the source.

AreaExtract

AreaExtract is a tool that replaces previous technology-specific frontends for the Calyx profiler, Petal. It offers a combined frontend for several sources of area data for accelerator designs, and outputs processed data in a common data format that is parseable by Petal. Currently, the following technologies are supported:

  • Vivado, as hierarchical area synthesis reports
  • Yosys, as both IL and statistics files

Usage

$ aext -h 
usage: aext [-h] [-o OUTPUT] {vivado,yosys} ...

Parse FPGA synthesis reports into a Common Data Format.

Supported origins:
  - Vivado: single hierarchical .rpt file
  - Yosys: .il (intermediate language) and .json (stat) file

Output is a JSON serialization of the Common Data Format.

positional arguments:
  {vivado,yosys}
    vivado              parse a Vivado utilization .rpt file
    yosys               parse Yosys IL and stat JSON files

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        optional output file for JSON (defaults to stdout)

Obtaining area data

This section provides instructions to obtain area data for designs from supported technologies, to use as input for AreaExtract.

Vivado

The simplest way to obtain a hierarchical area RPT file is to use Fud2 to run synthesis on a Calyx design:

fud2 <design>.futil --to area-report > <report>.rpt

Alternatively, it is possible to use Fud2 to obtain a synthesis-ready Verilog file, and then use Vivado directly to conduct synthesis. The relevant TCL command for Vivado is:

report_utilization -hierarchical -file <report>.rpt

Yosys

Using the OSS-CAD suite, IL and statistics files can be obtained as follows:

yosys -p "read_verilog -sv <VERILOG_FILE>.sv; hierarchy -top main; opt; write_rtlil <IL_FILE>.il; tee -o <STAT_FILE>.json stat -json"

It is also possible to pass Liberty files to the stat command through the flag -liberty <file>.

Future work

This tool is not yet a full replacement of its technology-specific predecessors, synthrep for Vivado and aprof for Yosys, as it is not able to produce area-only visualizations, which is a desirable feature. In addition, some of synthrep's functionality is unrelated to area, and is not in scope for AreaExtract. Another area that is being explored is the addition of other technologies, especially OpenROAD as it targets ASICs instead of FPGAs. While Yosys also offers ASIC capabilities, it is primarily oriented towards FPGAs; Vivado exclusively targets AMD FPGAs.

Copy link
Contributor

@ayakayorihiro ayakayorihiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, great work!!! Edit: Nvm fixed! As mentioned via DM I'm having some trouble running aext - if I can get some help on this that would be very appreciated :) Otherwise I left some minor comments.

Also before you merge, if you can write some tests for aext (one with maybe an input JSON and another with input yosys files) with the output being in the CDF, that would be super helpful!

This can be post-merge but just a question: Do you think we can produce area (tree map) visualizations via information given to us via the CDF? I'm also curious whether it might be better to have Petal make the visualization for us. We can also get aext to do this as initially planned, but this could be an alternative!


type YosysRsrc = dict[str, int]
"""
Yosys resources for a cell.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth describing what the int value is referring to here!

type ModuleCellTypes = dict[str, dict[str, CellWithParams]]


def parse_il_file_old(path: str) -> ModuleCellTypes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an unused function! Please remove :)

Using the OSS-CAD suite, IL and statistics files can be obtained as follows:

```
yosys -p "read_verilog -sv <VERILOG_FILE>.sv; hierarchy -top main; opt; write_rtlil <IL_FILE>.il; tee -o <STAT_FILE>.json stat -json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on slack, it would be great just to add a sentence here saying that the user should run fud2 with --through calyx-to-synth-verilog to generate <VERILOG_FILE>.sv.


This tool is not yet a full replacement of its technology-specific predecessors,
`synthrep` for Vivado and `aprof` for Yosys, as it is not able to produce area-only
visualizations, which is a desirable feature. In addition, some of `synthrep`'s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Area visualizations seem like a great next step :) I think it's ok to keep synthrep for the other functionalities, but it would make sense for us to remove aprof.

type DesignRsrc = dict[str, CellRsrc]


def parse_il_file_old(path: str) -> ModuleCellTypes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same deal with parse_il_file_old in AreaExtract!

import pandas as pd
import plotly.express as px
from profiler.classes.tracedata import UtilizationCycleTrace
from profiler.classes.tracedata import PTrace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason for the switch? Just curious!

@@ -0,0 +1,195 @@
import pathlib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code duplication here is ok for now since our plan is to deprecate this once aext gets visualization capabilities, but just wanted to flag this!

Hierarchical area wrapper.
"""

map: dict[str, dict[str, str]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this map a nested dictionary between again? A comment here would be super helpful!


- Vivado, as hierarchical area synthesis reports
- Yosys, as both IL and statistics files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the uv install command here too? (I think that was the issue) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants